<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
	<button id="sendAjax">提交</button>
<script type="text/javascript">
	$(function(){
		$('#sendAjax').click(function(){
			

			//发送ajax请求
			//url表示请求路径，即谁去处理这个请求，写一个servlet路径
			$.get("../getPost?id=1",function(data){
				console.log(data);
				var s="id="+data.id+"content="+data.content+"title="+data.title;
				$("#box").append(s);
			})
		});
	
	})
</script>
<div id="box">
	
</div>
</body>
</html>